<template>
  <div id="app1">
    <div class="progress-container">
      <div class="progress-bar" :style="{ width: progress + '%' }"></div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      progress: 0,
    };
  },
  methods: {
    startProgress() {
      let interval = setInterval(() => {
        if (this.progress >= 100) {
          clearInterval(interval);
        } else {
          this.progress += 1;
        }
      }, 50); // 每50毫秒增加1%
    },
  },
  mounted() {
    this.startProgress();
  },
};
</script>

<style>
#app1 {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

.progress-container {
  width: 80%;
  height: 30px;
  background-color: #f3f3f3;
  border-radius: 15px;
  overflow: hidden;
  margin: auto;
}

.progress-bar {
  height: 100%;
  width: 0;
  background-color: #4caf50;
  transition: width 0.5s;
}
</style>
